package array;

public class demo2 {
    public static void main(String[] args) {
        //遍历数组
        int[] arr = new int[10];
        //快捷键 arr.fori
        int summit=0;
        for (var i = 0; i < arr.length; i++) {
            arr[i] = i+1;
            summit += arr[i];
            System.out.println(arr[i]);
        }
        System.out.println("总和为："+summit);
    }
}
